#include "postorderTraversal.h"
void postorderTraversal(TreeNode* root, vector<int>& cache) {
  if (!root)
    return;
  else {
    postorderTraversal(root->left, cache);
    postorderTraversal(root->right, cache);
    cache.push_back(root->val);
  }
}
vector<int> postorderTraversal(TreeNode* root) {
  vector<int> res;
  postorderTraversal(root, res);
  return res;
}